import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from "@/views/Layout.vue";

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/Login.vue')
  },
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    redirect: '/home',
    children: [  // 子路由
      {
        path: 'home',
        name: 'Home',
        component: () => import('@/views/home/Home.vue'),
      },
      //  ====  User  ====
      {
        path: 'userList',
        name: 'UserList',
        component: () => import('@/views/user/User.vue'),
      },
      {
        path: 'addUser',
        name: 'AddUser',
        component: () => import('@/views/user/AddUser.vue'),
      },
      {
        path: 'editUser',
        name: 'EditUser',
        component: () => import('@/views/user/EditUser.vue'),
      },
      {
        path: 'productList',
        name: 'ProductList',
        component: () => import('@/views/product/Product.vue'),
      },
      {
        path: 'typeList',
        name: 'TypeList',
        component: () => import('@/views/type/Type.vue'),
      },
      {
        path: 'addType',
        name: 'AddType',
        component: () => import('@/views/type/AddType.vue'),
      },
      {
        path: 'editType',
        name: 'EditType',
        component: () => import('@/views/type/EditType.vue'),
      },
      {
        path: 'imageList',
        name: 'ImageList',
        component: () => import('@/views/image/Image.vue'),
      },
      {
        path: 'addImage',
        name: 'AddImage',
        component: () => import('@/views/image/AddImage.vue'),
      },
      {
        path: 'orderList',
        name: 'OrderList',
        component: () => import('@/views/order/0rder.vue'),
      },
      {
        path: 'unorderList',
        name: 'UnorderList',
        component: () => import('@/views/order/UnOrder.vue'),
      },
    ]
  },
]

const router = new VueRouter({
  routes
})

export default router
